import axios from 'axios';

class Service {

    static listTypes(callback) {
        return axios.get("/manage-api/dish-types").then((data) => {
            callback ? callback(data) : null;
        })
    }

    static updateTypes(types, callback) {
        return axios.post("/manage-api/dish-types", types).then((data) => {
            callback ? callback(data) : null;
        })
    }

    static listInterval(baseQuery, callback) {
        return axios.post("manage-api/list-interval", baseQuery).then((data) => {
            callback ? callback(data) : null;
        })
    }

    static detailInterval(id, callback) {
        return axios.get("/manage-api/interval/" + id).then((data) => {
            callback ? callback(data) : null;
        })
    }

    static removeInterval(id, callback) {
        return axios.delete("/manage-api/interval/" + id).then((data) => {
            callback ? callback(data) : null;
        })
    }

    static addInterval(dishInterval, callback) {
        return axios.post("/manage-api/interval/", dishInterval).then((data) => {
            callback ? callback(data) : null;
        })
    }

    static updateInterval(dishInterval, callback) {
        return axios.put("/manage-api/interval/", dishInterval).then((data) => {
            callback ? callback(data) : null;
        })
    }
}

export default Service;